Skip to content

Conversation

@Gonza10V
Copy link
Contributor

Motivation

  • Ensure any files created by the Opentrons simulator land inside the temporary staging folder so they are included in the produced ZIP archive.
  • Simplify log writing into the temp folder and remove an unused os import.

Description

  • In run_opentrons_script_with_json_to_zip copy the script and JSON into the temporary directory and call subprocess.run with the temp paths and cwd=tmpdir using [ "opentrons_simulate", str(tmp_script), str(tmp_json) ], so the simulator runs inside the temp folder.
  • Save the captured stdout into tmpdir / "build_log.txt" using Path APIs instead of os.path.
  • Remove the now-unused import os from src/buildcompiler/robotutils.py.

Testing

  • Ran python -m pytest, which exercised the test suite but completed with failures unrelated to this change: 4 failing tests and 3 errors caused by external network/proxy errors when sbol2 attempted validation against remote endpoints (e.g. validator.sbolstandard.org).
  • Ran ruff check ., which reported many pre-existing lint issues across notebooks and other files; the change removed a single unused import but the overall lint run did not pass.
  • Conclusion: the change to run the simulator in the temp directory and write the log succeeded locally in code, but automated test runs were impeded by external network and preexisting linter problems, not by this change.

Codex Task

@Gonza10V Gonza10V merged commit 38af344 into main Jan 17, 2026
4 checks passed
@Gonza10V Gonza10V deleted the codex/update-subprocess.run-to-use-tmpdir branch January 17, 2026 06:02
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ee8e3899b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +133 to +137
# Run script (which has opentrons script hardcoded) using JSON file
log = subprocess.run(
["opentrons_simulate", str(tmp_script), str(tmp_json)],
capture_output=True,
cwd=tmpdir,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep simulator cwd where relative inputs exist

Running opentrons_simulate with cwd=tmpdir means the protocol executes in a directory that does not contain the files/ subfolder, but the protocol script still hardcodes open("files/assemblyplan_output.json", ...) and writes output into files (see files/run_sbol2assembly_libre.py:305–311). Because only assemblyplan_output.json is copied to the tmpdir root, this change causes a FileNotFoundError (or later failure when writing the XLSX) for the standard workflow where the script expects the repo’s files/ directory. Unless you also recreate files/ inside the tempdir or adjust the protocol to use the passed JSON path, the simulator will now fail before producing a zip.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants